import React from './react'
import ReactDOM from './react-dom'

class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      number: 1,
    }
  }

  handleClick = () => {
    console.log('handleClick')
    this.setState(
      {
        number: this.state.number + 1,
      },
      () => {
        console.log('callback', this.state.number)
      }
    )
  }

  render() {
    return (
      <div style={{ color: 'red' }}>
        hello, {this.props.name}!
        <p>{this.state.number}</p>
        <button onClick={this.handleClick}>点我</button>
      </div>
    )
  }
}

ReactDOM.render(<App name="feline" />, document.getElementById('root'))
